﻿<UserControl x:Class="VoiceRecorder.RecorderView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="clr-namespace:VoiceRecorder.Core;assembly=VoiceRecorder.Core">
    <UserControl.Resources>
        <Style x:Key="{x:Type ProgressBar}"
     TargetType="{x:Type ProgressBar}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ProgressBar}">
                        <Grid MinHeight="14" MinWidth="200">
                            <Border Name="PART_Track">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <GradientStop Offset="0" Color="#FF00FF00" />
                                        <GradientStop Offset="0.9" Color="#FFFFFF00" />
                                        <GradientStop Offset="1" Color="#FFFF0000" />
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <DockPanel>
                                <Rectangle DockPanel.Dock="Left" Name="PART_Indicator" />
                                <Rectangle Name="Mask" Fill="#C0C0C0" />
                            </DockPanel>
                            <Border BorderThickness="1" BorderBrush="#888888" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel Background="Khaki">
        <Label Margin="5" HorizontalAlignment="Center" FontWeight="Bold" FontSize="20">.NET Voice Recorder</Label>
        <Label Margin="5">Check the levels before starting recording:</Label>
        <ProgressBar Margin="5" Orientation="Horizontal" Value="{Binding CurrentInputLevel, Mode=OneWay}" Height="20" />
        <Label Margin="5">Microphone Level:</Label>
        <Slider Margin="5" Orientation="Horizontal" Value="{Binding MicrophoneLevel, Mode=TwoWay}" Maximum="100" />
        <StackPanel Orientation="Horizontal">
            <Button Style="{StaticResource CircleButton}" Command="{Binding BeginRecordingCommand}" Margin="5" ToolTip="Start Recording" />
            <Button Style="{StaticResource StopButton}" Command="{Binding StopCommand}" Margin="5" ToolTip="Stop Recording" />
            <Border BorderBrush="Black" BorderThickness="2" CornerRadius="3" Margin="2">
                <TextBlock Margin="3,1" Text="{Binding RecordedTime}" FontWeight="Bold" FontSize="16"/>
            </Border>
        </StackPanel>        
        <my:PolygonWaveFormControl Margin="5" Height="40" SampleAggregator="{Binding SampleAggregator}" IsEnabled="{Binding ShowWaveForm}" />
    </StackPanel>
</UserControl>
